<template>
<div class="text">
    <textarea placeholder="嗨一嗨" v-model="content" @keyup="onKeyup"></textarea>
</div>
</template>
<script>

    export default {

        data () {
            return {
                content: ''
            };
        },
        methods: {
            onKeyup (e) {
                this.content = this.content.replace(/[\r\n]/g,"");
                if (e.keyCode === 13 && this.content.length > 1) {
                    this.$parent.send_msg(this.content);
                    this.content = '';
                }
            }
        }
    };
</script>
<style lang="less" scoped>
.text {
    height: 160px;
    border-top: solid 1px #ddd;

    textarea {
        padding: 10px;
        height: 100%;
        width: 100%;
        border: none;
        outline: none;
        font-family: "Micrsofot Yahei";
        resize: none;
    }
}
</style>